<template>
  <i-action-sheet :visible="visible" :actions="shopSheet" show-cancel @cancel="shopSheetCancel" @iclick="shopSheetClick" />
</template>

<script>
  export default {
    props: ['visible', 'cancel'],
    data() {
      return {
        shopSheet: [{
            name: '拨打电话：18859555677',
            phone: '拨打电话：18859555677'
          },
          {
            name: '添加微信：weixin233',
            wx: 'weixin233'
          },
        ],
      }
    },
    methods: {
      shopSheetCancel() {
        this.cancel()
      },
      shopSheetClick(e) {
        switch (e.mp.detail.index) {
          case 0:
            wx.makePhoneCall({
              phoneNumber: this.shopSheet[e.mp.detail.index].phone,
            })
            break;
          case 1:
            copyClipboard(this.shopSheet[e.mp.detail.index].wx)
            break;
        }
        this.shopSheetCancel()
      },
    },
  }

</script>

<style>
  .card {
    padding: 10px;
  }

</style>
